package lab02.test05;

//立方体类
public class Cube {
    float length;
    float wide;
    float high;

    public Cube() {
    }

    //初始化成员变量
    public Cube(float length, float wide, float high) {//有参构造
        this.length = length;
        this.wide = wide;
        this.high = high;
    }
    //求立方体的体积
    public float volume() {
        return length * wide * high;
    }

    public static void main(String[] args) {
        Cube c1 = new Cube(3, 4, 5);
        System.out.println("立方体的长、宽、高为："
                + c1.length+"\t"+ c1.wide + "\t" + c1.high);
        System.out.println("体积为：" + c1.volume());
    }

}
